package com.cs.rocketmq.controller;

import com.cs.rocketmq.config.Producer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author shuai
 * @date 2019/5/20
 */
@RestController
@EnableAutoConfiguration
public class TestController {

    @Autowired
    private Producer producer;

    @RequestMapping(value = "/push")
    public String pushMsg(){
        try {
            return producer.send("PushTopic","push","hello");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "ERROR";
    }

}
